Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set container port to zero to allocate available tcp port #13

Merged
merged 1 commit into from
Jun 21, 2021
Merged

Set container port to zero to allocate available tcp port #13

merged 1 commit into from
Jun 21, 2021

Conversation

lordjaxom
Copy link
Contributor

We use JerseyExtension in unit tests and sometimes the problem occurs that multiple Jenkins builds run some of these tests in parallel, which leads to test failures because the default port 9998 is not available.

This commit sets the container port to "0" in order to let Jersey allocate any unused port.

I've thought about making this configurable, but so far couldn't come up with a reason why this shouldn't be the default. Any thoughts?

@codecov
Copy link

codecov bot commented Jun 14, 2021

Codecov Report

Merging #13 (952f64b) into master (35fc243) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@             Coverage Diff             @@
##              master       #13   +/-   ##
===========================================
  Coverage     100.00%   100.00%           
  Complexity        13        13           
===========================================
  Files              1         1           
  Lines             42        43    +1     
  Branches           2         2           
===========================================
+ Hits              42        43    +1     
Impacted Files Coverage Δ
.../main/java/com/github/hanleyt/JerseyExtension.java 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 35fc243...952f64b. Read the comment docs.

@hanleyt
Copy link
Owner

hanleyt commented Jun 21, 2021

hey @lordjaxom!
Thanks very much for the PR! Glad you're making use of the library.

I think this looks good to me. Not sure why its not the default in jersey test, but the docs say you should do this if you want to run tests in parallel to get the next available port.

@hanleyt hanleyt self-requested a review June 21, 2021 19:12
@hanleyt hanleyt merged commit 6bd9419 into hanleyt:master Jun 21, 2021
@lordjaxom
Copy link
Contributor Author

Thank you for approving and merging. Any idea if you are going to publish 2.2.0 to maven central?

@tomashanley-toast
Copy link
Contributor

yeah sorry, i was having an issue with it last night but will try get it published today.

@hanleyt
Copy link
Owner

hanleyt commented Jun 22, 2021

Hey @lordjaxom,
2.2.0 should be available on maven central now if you want to try it out.
Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants